package com.sls.game.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.sls.game.dao.CardInformationDAO;
import com.sls.game.pojo.CardInformation;

@Repository("cardInformationDAO")
public class CardInformationImpl extends SuperDAO<CardInformation> implements
		CardInformationDAO {

	@Override
	public int insert(CardInformation cardInfo) {
		return this.getSqlSession().insert(
				"mybatis.xml.CardInformationMapper.insert", cardInfo);
	}

	@Override
	public List<CardInformation> queryAll() {
		List<CardInformation> info = this.getSqlSession().selectList(
				"mybatis.xml.CardInformationMapper.queryAll");
		return info;
	}

	@Override
	public CardInformation query(String cardId) {
		return this.getSqlSession().selectOne(
				"mybatis.xml.CardInformationMapper.query", cardId);
	}

	@Override
	public int update(CardInformation cardInfo) {
		return this.getSqlSession().update(
				"mybatis.xml.CardInformationMapper.update", cardInfo);
	}

	@Override
	public CardInformation queryBySerial(String serial) {
		return this.getSqlSession().selectOne(
				"mybatis.xml.CardInformationMapper.queryBySerial", serial);
	}

	@Override
	public void updateSaleState(CardInformation cardInfo) {
		this.getSqlSession().update(
				"mybatis.xml.CardInformationMapper.updateSaleState", cardInfo);
	}

}
